import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';
export namespace PerCelebrationsApi {
  /** 人员婚丧喜庆信息 */
  export interface Celebrations {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    relation: string; // 与本人关系
    eventType: string; // 操办事项
    eventDate: string | Dayjs; // 办理时间
    eventLocation: string; // 办理地点
    participants: string; // 参加人数
    giftHandling: string; // 接受礼品及处理情况
    reportStatus: string; // 有否报告
    status: number; // 记录状态（1：有效，0：无效）
    remarks: string; // 备注
  }
}

/** 查询人员婚丧喜庆分页 */
export function getCelebrationsPage(
  data: PageParam,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<PageResult<PerCelebrationsApi.Celebrations>>(
    '/per/celebrations/page',
    data,
    { desensitize, encrypt },
  );
}

/** 查询人员婚丧喜庆详情 */
export function getCelebrations(id: number) {
  return requestClient.get<PerCelebrationsApi.Celebrations>(
    `/per/celebrations/get?id=${id}`,
  );
}

/** 新增人员婚丧喜庆 */
export function createCelebrations(data: PerCelebrationsApi.Celebrations) {
  return requestClient.post('/per/celebrations/create', data);
}

/** 修改人员婚丧喜庆 */
export function updateCelebrations(data: PerCelebrationsApi.Celebrations) {
  return requestClient.put('/per/celebrations/update', data);
}

/** 删除人员婚丧喜庆 */
export function deleteCelebrations(id: number) {
  return requestClient.delete(`/per/celebrations/delete?id=${id}`);
}

/** 批量删除人员婚丧喜庆 */
export function deleteCelebrationsList(ids: number[]) {
  return requestClient.delete(
    `/per/celebrations/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出人员婚丧喜庆 */
export function exportCelebrations(params: any) {
  return requestClient.download('/per/celebrations/export-excel', { params });
}
